import { createBrowserRouter, redirect } from "react-router-dom";

import Portal from "../pages/Portal";

import Layout from "../pages/Layout/Layout";
import Channel from "../pages/Channel/Channel";
import Notice from "../pages/Notice/Notice";
import Private from "../pages/Private/Private";
import MusicPage from "../pages/Music";

import Login from "../pages/Login/Login";

import TestPage from "../pages/Test";

import PersonalInfo from "../pages/PersonalInfo";

const router = createBrowserRouter([
    {
        path: '/',
        element: <Portal/>,
        children:[
            {
                path: "/",
                element: <Layout/>,
                children:[
                    {
                        index: true,
                        loader:()=> redirect('/notice')
                    },
                    {
                        path: "/servers",
                        element: <Channel/>
                    },
                    {
                        path: "/notice",
                        element: <Notice/>
                    },
                    {
                        path: "/private",
                        element: <Private/>,
                    },
                    {
                        path: "/music",
                        element: <MusicPage/>
                    }
                ]
            },
            {
                path: "/personal",
                element: <PersonalInfo/>
            },
        ]
    },
    {
        path: "/login",
        element: <Login/>
    },
    {
        path: '/test',
        element: <TestPage/>
    }
])

export default router